home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / dtjobjct11.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-12  |  9.3 KB  |  296 lines

  1. #ifndef _DTJOBJCT11_HPP
  2. #define _DTJOBJCT11_HPP
  3.  
  4. #include "dtobject.hpp"
  5. #include "dtformbs.hpp"
  6.         
  7. #define JAVA_FILE_EXTENSION             WTEXT(".java")
  8. #define JAVA_CLASS_EXTENSION            WTEXT(".class")
  9.  
  10. struct MMJCodeGenerationParms;
  11.  
  12. class METAEXPORTCLASSDEF DTJObjectBase11 : public DTObjectBase
  13. /************************************************************/
  14. {
  15.     public:
  16.         virtual       ~DTJObjectBase11();
  17.  
  18.     virtual    WJavaObject*    GetWJavaObject() const;
  19.  
  20.     // Returns the WJavaObject used by the form painter at
  21.     // design time, if such an object exists.
  22.     // Returns NULL otherwise.
  23.     virtual WJavaObject *    GetJImplementation() const;
  24.  
  25.         virtual WBool GetIsHollow();                // groupbox
  26.  
  27.     virtual WBool GetImplements( const WString & ) const;
  28.  
  29.     virtual void GenFileFragment( MMFileFragment fg, WStringList &,
  30.                       MMFileGenerationParms * parms ) const;
  31.  
  32.     // not used any more
  33.         void GenCode( MMCodeGeneration mmCodeGen,
  34.               WStringList& srcList ) const;
  35.  
  36.     WBool DoJavaPainting() const;
  37.  
  38.     void SetNonImplementationJavaObj( WJavaObject * javaObj );
  39.  
  40.     virtual WBool CanCreateNonImplementationJavaObj() const;
  41.  
  42.     static PropertyInspectObject * MakePropEditor_dataSource(
  43.             const MMProperty * prop, PropertyInspector * prt,
  44.             WUInt numObject, DTObject ** objects );
  45.  
  46.     static PropertyInspectObject * MakePropEditor_dataColumns(
  47.             const MMProperty * prop, PropertyInspector * prt,
  48.             WUInt numObject, DTObject ** objects );
  49.     
  50.     public:
  51.  
  52.         // override this to demangle the Meta object name
  53.     virtual void GenClassName( WString & ) const;
  54.  
  55.     //
  56.     // Style
  57.     //
  58.     //    The Windows style property of the associated Window.
  59.     //    This doesn't necessarily match GetWindow()->GetStyle()
  60.     //    because some styles are deferred until run-time (such
  61.     //    as WSVisible).
  62.  
  63.     virtual WStyle        GetStyle() const;
  64.     virtual WBool        SetStyle( WStyle stl, WBool clone=FALSE );
  65.  
  66.     //
  67.     // DefaultStyle
  68.     //
  69.     //    The style with which new instances are created.  Default
  70.     //    implementation returns GetWindow()->GetDefaultStyle().
  71.  
  72.     virtual WStyle        GetDefaultStyle() const;
  73.  
  74.     //
  75.     // ExtendedStyle
  76.     //
  77.     //    The ExtendedStyle property of the window nature.
  78.  
  79.     virtual WStyle        GetExtendedStyle() const;
  80.     virtual WBool        SetExtendedStyle( WStyle style, WBool clone=FALSE );
  81.  
  82.     //
  83.     // DefaultExtendedStyle
  84.     //
  85.     //    See DefaultStyle
  86.  
  87.     virtual WStyle        GetDefaultExtendedStyle() const;
  88.  
  89.  
  90.     //
  91.     // Visible
  92.     //
  93.     //    The object is currently visible.
  94.  
  95.     virtual WBool        GetVisible();
  96.     virtual WBool        SetVisible( WBool visible );
  97.  
  98.     //
  99.     // Create
  100.     //
  101.     //    Call Create on the windowed object.
  102.     //
  103.     virtual WBool        Create( WWindow * parent, const WRect & r,
  104.                         const WChar * text, WStyle style,
  105.                     WStyle exStyle, void * data = NULL,
  106.                     WBool isLoading = FALSE );
  107.         //
  108.         // Rectangle
  109.         //
  110.         //    The pixel-based position of the object; optionally, absolute
  111.         //    to the desktop.  
  112.  
  113.         virtual void            DTGetRectangle( WRect & r, 
  114.                                                 WBool abs = FALSE ) const;
  115.         virtual void            DTSetRectangle( const WRect & r,
  116.                                                 WBool abs = FALSE );
  117.         virtual WRect           DTGetDURectangle( WBool abs = FALSE ) const;
  118.  
  119.         //
  120.         // ClientRectangle
  121.         //
  122.         //    Get the client rectangle.  This is mainly used for DTForms.
  123.  
  124.         virtual void            DTGetClientRectangle( WRect & r ) const;
  125.  
  126.         //
  127.         // RCRectangle
  128.         //
  129.         //    The rectangle to use in the .rc file (still in pixel though).
  130.         //    This differs for WComboBox, which gives a .rc file rectangle
  131.         //    of the correct height instead of the design time height.
  132.  
  133.         virtual void            DTGetRCRectangle( WRect & r ) const;
  134.  
  135.         //
  136.         // PixelsToDLU / DLUToPixels
  137.         //
  138.         //    Map between pixels and dialog units (DLU).
  139.  
  140.         virtual WRect           DTMapPixelsToDLU( const WRect & pix ) const;
  141.         virtual WRect           DTMapDLUToPixels( const WRect & dlu ) const;
  142.  
  143.         //
  144.         // BringToTop
  145.         //
  146.         //    Bring the object to the top of the Z- order
  147.  
  148.         virtual void            DTBringToTop();
  149.  
  150.         //
  151.         // Repaint
  152.         //
  153.         //    Invalidate an object and cause it to be repainted
  154.  
  155.         virtual void            DTRepaint( WRect * rect=NULL );
  156.  
  157.  
  158.         //
  159.         // ObjectPrefix
  160.         //
  161.         //    Get the prefix used when accessing member functions of the
  162.         //    object -- eg. "cb_1->"
  163.  
  164.         virtual WString GetObjectPrefix() const;
  165.  
  166.     //
  167.     // IsValidContainer
  168.     //
  169.     //    Returns true if obj is allowed as a container for this
  170.     //    DTObject.  errMsg is filled in with details about
  171.     //    about why it isn't allowed.
  172.     virtual WBool        IsValidContainer(
  173.                     const DTObject *obj,
  174.                     WString &errMsg ) const;
  175.  
  176.     virtual void AmendPopup( WPopupMenu * popup, WBool before );
  177.  
  178.     WBool HandleCustomizeMenuClick( WObject *, WEventData * );
  179.  
  180.     virtual void GenerateCode( MMCodeGeneration mmCodeGen,
  181.                    ostream& src,
  182.                    MMCodeGenerationParms& pGenParms );
  183.  
  184.     virtual void EmitProperties( const WString& objPrefix,
  185.                      ostream& src ) const;
  186.  
  187.     virtual void EmitProperty( const WString& objPrefix, ostream& src,
  188.                    const MMProperty * prop ) const;
  189.  
  190.     virtual WString     DTGetName() const;
  191.  
  192.     virtual void GenName( WUInt id, WString & ) const;
  193.  
  194.     virtual void PropertyChanged( const WString & name );
  195.  
  196.     virtual void AddEventsToList( DTUserFunctionVect* pEventList,
  197.                       WBool recurseChildren );
  198.  
  199.     virtual void GenEventObjectName( WString & ) const;
  200.  
  201.     WBool PreventUpdates();
  202.     WBool AllowUpdates();
  203.  
  204.     void SetSerializableLevelOne( WBool on ) { ( on ) ? (_serializableLevelOne = 1) : (_serializableLevelOne = -1); }
  205.     WBool GetSerializableLevelOne() const { return ( _serializableLevelOne == 1 ); }
  206.     WBool GetSerializableLevelOneValid() const { return ( _serializableLevelOne != 0 ); }
  207.     void SetSerializableLevelTwo( WBool on ) { ( on ) ? (_serializableLevelTwo = 1) : (_serializableLevelTwo = -1); }
  208.     WBool GetSerializableLevelTwo() const { return ( _serializableLevelTwo == 1 ); }
  209.     WBool GetSerializableLevelTwoValid() const { return ( _serializableLevelTwo != 0 ); }
  210.  
  211.     //
  212.     // FDX
  213.     //
  214.  
  215.     virtual WBool GetDDXEnabled() const;
  216.     virtual void SetDDXEnabled( WBool );
  217.  
  218.     virtual void        EscapeCString( WString &, const WString & ) const;
  219.  
  220.     protected:
  221.         virtual void GenerateCreate( const WString& objPrefix,
  222.                                  ostream& src,
  223.                        MMJCodeGenerationParms* pGenParms ) const;
  224.         virtual void GeneratePreAdd( const WString& objPrefix,
  225.                                  ostream& src,
  226.                        MMJCodeGenerationParms* pGenParms ) const;
  227.     virtual void GenerateImports( ostream& src,
  228.                         MMJCodeGenerationParms* pGenParms ) const;
  229.  
  230.     virtual void GenerateEvents( ostream& src,
  231.                        MMJCodeGenerationParms* pGenParms ) const;
  232.  
  233.     virtual void GenerateAddListenerCode( const WString prefix,
  234.                                               ostream& src,
  235.                           MMJCodeGenerationParms* pGenParms ) const;
  236.  
  237.         virtual void GenerateCreateEvent( const WString& objPrefix,
  238.                                       ostream& src,
  239.                             MMJCodeGenerationParms* pGenParms ) const;
  240.  
  241.         virtual void GenerateDestroyEvent( const WString& objPrefix,
  242.                                       ostream& src,
  243.                             MMJCodeGenerationParms* pGenParms ) const;
  244.  
  245.         virtual WStyle CheckExtraStyles(WStyle style);
  246.  
  247.     WString GetLastPart( const WString &fulltype ) const;
  248.  
  249.     virtual WString GetControlScope() const;
  250.  
  251.     private:
  252.     WBool        handleObjectLoading( WObject *, WEventData * );
  253.  
  254.     protected:
  255.         DTJObjectBase11( const MetaObject * pMetaObj = NULL );
  256.  
  257.     WBool        _doJavaPainting;
  258.     WMenuItem *    _customizeMenuItem;
  259.     WRect        _latestDTRect;
  260.     WJavaObject *    _customizer;
  261.     WJavaObject *    _customizerForm;
  262.     WJavaObject *    _nonImplementationJavaObj;
  263.     WInt        _allowUpdates;
  264.     WInt        _serializableLevelOne;
  265.     WInt        _serializableLevelTwo;
  266. };
  267.  
  268. class METAEXPORTCLASSDEF DTJObject11 : public DTJObjectBase11
  269. /***********************************************************/
  270. {
  271.     public:
  272.         virtual       ~DTJObject11();
  273.  
  274.     static PropertyInspectObject *
  275.     MakePropEditor_SerializationData( const MMProperty * prop,
  276.                       PropertyInspector * prt,
  277.                       WUInt numObject, DTObject ** objects );
  278.  
  279.     protected:
  280.         DTJObject11( const MetaObject * pMetaObj = NULL );
  281. };
  282.  
  283. // needed for mdreader
  284. typedef DTJObject11 DTjava__dot__lang__dot__Object__dot__11;
  285. typedef DTJObjectBase11 DTpowersoft__dot__generic__dot__Object__dot__11;
  286.  
  287. class MMProperty;
  288. class PropertyInspectObject;
  289. class PropertyInspector;
  290.  
  291. extern PropertyInspectObject * METAEXPORTDEF PropertyJavaCustomEditorIObj_0_Make_11( const MMProperty * prop, PropertyInspector * prt, WUInt n, DTObject ** o );
  292. extern PropertyInspectObject * METAEXPORTDEF PropertyJavaCustomEditorIObj_1_Make_11( const MMProperty * prop, PropertyInspector * prt, WUInt n, DTObject ** o );
  293. extern PropertyInspectObject * METAEXPORTDEF PropertyJavaCustomEditorIObj_2_Make_11( const MMProperty * prop, PropertyInspector * prt, WUInt n, DTObject ** o );
  294.  
  295. #endif // _DTJOBJCT11_HPP
  296.